<html  xmlns:th="http://www.thymeleaf.org">
<html>
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta name="format-detection" content="telephone=no, address=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black-translucent" name="apple-mobile-web-app-status-bar-style">
    <title></title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
    <link href="https://cdn.bootcss.com/jquery-mobile/1.4.5/jquery.mobile.theme.css" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

    <script src="/weixin/js/jquerymobile_popup.js"></script>

    <script type="text/javascript">

        $(function(){
            showMyMeetings();
        });





        function showMyMeetings() {



            $("#two").empty();

            var pid=$("#pid").val();

            $.ajax({
                type:"get",
                url:"/meetingPub/selectGrabListChooseByPid",
                data:{"pid":pid},
                success:function(objs){

                    if(objs.code=="2000"){


                        var dataObj=objs.data;

                        var appendHtml = "<font style='padding: 10px 10px 10px 15px;display: block;color: #777777;'>共有"+dataObj.length+"人参与会议</font>";

                        for(var i=0;i<dataObj.length;i++){
                            var  name=dataObj[i].user.name;
                            var  province=dataObj[i].user.province;
                            var  city=dataObj[i].user.city;
                            var grabStatus=dataObj[i].grabStatus;
                            var uid=dataObj[i].user.id;
                            appendHtml += "<div style='width: 100%;background-color: white;margin-top: -3px;padding:10px 10px 10px 15px;display: inline-block;'>" +
                                "<div style='width: 70%;float: left;' onclick='showMeetingInfo(\"" +1 + "\");'>" +
                                "<div style='white-space: nowrap;overflow: hidden;text-overflow:ellipsis;display: block;font-size:18px;'>" +
                                name + "</div>" +
                                "<div style='white-space: nowrap;overflow: hidden;text-overflow:ellipsis;display: block;color: #777777;font-size:16px;padding-top:1px'>" +
                                province + " / " +city + "</div></div>" +
                                "<div style='width: 30%;float: right;'>" ;

                                if(grabStatus==0){
                                    appendHtml+="<button class='able-btn' onclick='chooseGrapByUid(\""+uid+"\")' >就选你</button>";
                                }else if(grabStatus==1){
                                    appendHtml+="<h4>已选择</h4>";
                                }else if(grabStatus==2){
                                    appendHtml+="未选择";
                                }

                                appendHtml+= "</div></div>";

                        }
                        $("#two").append(appendHtml);
                    }
                }
            });
        }
        
        
        function chooseGrapByUid(uid) {

            var pid=$("#pid").val();

            //openPopup('邮箱不能为空','提示',undefined,true,undefined,'error','cn');

            if(confirm("确定要选择该用户做为讲者吗？")){
                $.ajax({
                    type:"post",
                    url:"/meetingPub/chooseGrabByUidAndPid",
                    data:{"pid":pid,"uid":uid},
                    success:function(objs){
                        if(objs.code=="2001"){
                            openPopup('网络繁忙，稍候再试','提示',undefined,true,undefined,'error','cn');
                        }else if(objs.code=="2000"){
                            openPopup('选择成功','提示',undefined,true,undefined,'error','cn');
                            window.location.href="/meetingPub/chooseGrabListToPage?pid="+pid;
                        }
                    }
                });
            }


        }

    </script>
</head>
<body>
<form name="formMeetingInfo" action="" method="post">
    <input type="text" id="pid" name="pid" th:value="${pid}">
</form>
<div data-role="page" id="pageDetail">
    <div style="padding:0px;background-color: #4E90C7;width: 100%;height:40px;line-height:40px;font-size:18px;text-align: center;cursor: pointer;" data-role="none">
        <div style="color: white;" onclick="showMyMeetings();" id="two_tab">抢单者列表</div>
    </div>
    <div id="two" class="ui-body-d ui-content" style="padding: 0;width: 100%;">

    </div>
</body>

</html>